<template>
  <view class="detail_wrap">
    <view class="top">
      <text class="title">{{ title }}</text>
      <view class="date">{{ date }}</view>
    </view>
    <view class="detail">
      <u-parse :content="html" :tagStyle="parseStyle"></u-parse>
    </view>
  </view>
</template>

<script>
import { getNoticeDetail } from "@/config/api.js";
let notId;
export default {
  data() {
    return {
      id: "",
      title: "",
      date: "",
      html: "",
    };
  },
  onLoad: (options) => {
    notId = options.id;
    console.log("notId", notId);
  },
  mounted() {
    this.getNoticeDet(notId);
  },
  methods: {
    getNoticeDet(id) {
      getNoticeDetail({ _id: id })
        .then((res) => {
          console.log("getDetail====", res);
          if (res.code === 200) {
            this.title = res.data.title;
            this.date = res.data.createTime;
            this.html = res.data.articleText;
          }
        })
        .catch((err) => console.log("错误了", err));

      // requestGet(`/home/content/detail/${id}`, null, '/baseplatform').then(res => {
      // 	if (res.code === 200) {
      // 		this.title = res.data.title
      // 		this.date = res.data.createTime
      // 		this.html = res.data.articleText
      // 	}
      // }).catch((err) => console.log('错误了', err))
    },
  },
};
</script>

<style lang="scss" scoped>
.detail_wrap {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  .top {
    box-sizing: border-box;
    padding: 48rpx 40rpx;
  }
  .title {
    font-size: 32rpx;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.8);
    line-height: 44rpx;
  }
  .date {
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.5);
    line-height: 34rpx;
    margin-top: 24rpx;
  }
  .detail {
    padding: 32rpx;
    border-top: 2rpx solid rgba(0, 0, 0, 0.1);
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.7);
    text-align: justify;
    line-height: 1.5;
  }
}
</style>
